home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / sl.arc / SL.BAS next >
BASIC Source File  |  1987-08-28  |  2KB  |  63 lines

  1. print "This program will allow you to write the date and time with a note to"
  2. print "a file.  The note (ex. payroll_for_H.M.CO._begun) and the filename"
  3. print "should be added as command line arguments when running."
  4. print ""
  5. print "Questions or suggestions can be addressed to:"
  6. print "Jerry A. Shenk"
  7. print "SYSOP on LABB (717) 394-1357 3/12/2400 baud 8N1"
  8. print ""
  9. print ""
  10.  
  11. main:
  12. cline$ = command$
  13. length = len(cline$)
  14. dim arg$(10)
  15. gosub argsplit
  16. gosub datline
  17. gosub writefile
  18. end
  19.  
  20.  
  21. argsplit:                          ' subroutine to split cammand line
  22.     true = -1 : false = 0      ' define logical flags
  23.     i = 1 : num = 0 : inword = true
  24.     while i <= length
  25.         ch$ = mid$(cline$,i,1)
  26.         if ch$ <> " " then
  27.             if not inword then inword = true
  28.             arg$(num) = arg$(num) + ch$
  29.         elseif inword then
  30.             num = num + 1
  31.             inword = false
  32.         end if
  33.         i = i + 1
  34.     wend
  35. return
  36.  
  37. datline:
  38. if num = -1 then
  39.         print "You must give at least one argument from the DOS command line."
  40.         print "The syntax is:"
  41.         print "         SL note_to_include_with_time filename"
  42.         print ""
  43.         print "The filename is optional.  If deleted the note and the time "
  44.     print "be saved to a file called SL.PRE"
  45.     end
  46. end if
  47.  
  48. td$ = date$ + " " + time$
  49. datline$ = td$ + " " + arg$(0)
  50. return
  51.  
  52. writefile:
  53. if num > 0 then
  54.         datfile$ = arg$(1)
  55. else
  56.         datfile$ = "SL.PRE"
  57. end if
  58.                    
  59. open "a",1,datfile$
  60. print #1, datline$
  61. close 1
  62. return
  63.